package com.fly.sms;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;

import com.fly.sms.progress.ThreadProcess;
import com.fly.sms.service.CustomerService;
import com.fly.sms.util.C;

public class AccountActivity extends BaseActivity {
	TextView Name;
	TextView LoginName;
	TextView MsgBalance;
	TextView Price;
	TextView PayType;
	TextView AllowSendTimeFrom;
	TextView AllowSendTimeTo;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		View view = this.getView(R.layout.account);
		content.addView(view);
		title.setText(R.string.nav2_customer_info);
		Name=(TextView)findViewById(R.id.Name);
		LoginName=(TextView)findViewById(R.id.LoginName);
		MsgBalance=(TextView)findViewById(R.id.MsgBalance);
		Price=(TextView)findViewById(R.id.Price);
		PayType=(TextView)findViewById(R.id.PayType);
		AllowSendTimeFrom=(TextView)findViewById(R.id.AllowSendTimeFrom);
		AllowSendTimeTo=(TextView)findViewById(R.id.AllowSendTimeTo);
		new ThreadProcess(this,new ThreadProcess.onProcess() {
			
			@Override
			public void onStart() {
				customer=CustomerService.get(customer.get("LoginName").toString());
			}
			
			@Override
			public void onFinished() {
				if(customer!=null){
					Name.setText(customer.get("Name").toString());
					LoginName.setText(customer.get("LoginName").toString());
					MsgBalance.setText(customer.get("MsgBalance").toString());
					Price.setText(customer.get("Price").toString());
					if(customer.get("PayType").toString().equals("1")){
						PayType.setText(R.string.PayType1);
					}else{
						PayType.setText(R.string.PayType2);
					}
					AllowSendTimeFrom.setText(customer.get("AllowSendTimeFrom").toString());
					AllowSendTimeTo.setText(customer.get("AllowSendTimeTo").toString());
				}else{
					//showMsg(getText(R.string.oprfail));
				}
			}
		}).startProgress();
	
	}
}